#include "../headers/Word.h"

Word::Word(void)
: BaseWord(Word::WORD_SIZE)
{
}


Word::Word(const signed char sign, const unsigned char values[])
: BaseWord(Word::WORD_SIZE, sign, values)
{
}


Word::~Word(void)
{
}


unsigned char Word::op_code() const
{
	return this->value_bytes()[Word::WORD_SIZE - 1];
}


unsigned char Word::modification_code() const
{
	return this->value_bytes()[Word::WORD_SIZE - 2];
}


unsigned char Word::index_specification() const
{
	return this->value_bytes()[Word::WORD_SIZE - 3];
}


void Word::unwrap_modification_code(unsigned short &left, unsigned short &right) const
{
	unsigned char modCode = this->modification_code();
	right = modCode % 8;
	left = (modCode - right) / 8;
}
